import request from "@/utils/request";

export const add = (params) => {
  const { trainCode, index, seatType, rowCount } = params;
  return request.post("/system/train-carriage/add", {
    trainCode,
    index,
    seatType,
    rowCount,
  });
};

export const getPage = (pageNo, pageSize, search) => {
  const { code } = search;
  return request.post("/system/train-carriage/page", {
    pageNo,
    pageSize,
    code,
  });
};

export const remove = (id) => {
  return request.delete(`/system/train-carriage/remove/${id}`);
};

export const edit = (params) => {
  const { id, trainCode, index, seatType, rowCount } = params;
  return request.post("/system/train-carriage/edit", {
    id,
    trainCode,
    index,
    seatType,
    rowCount,
  });
};

export const getTrainCarriage = (params) => {
  const { trainCode, index } = params;
  return request.post("/system/train-carriage/one", {
    trainCode,
    index,
  });
};
